package main

import (
	"fmt"
	"net/http"

	"gitee.com/DengAnbang/Computation/src/api"
	"gitee.com/DengAnbang/Computation/src/config"
	"gitee.com/DengAnbang/Computation/src/socket"
	"gitee.com/DengAnbang/goutils/loge"
	"gitee.com/DengAnbang/goutils/sysUtils"
	_ "github.com/mattn/go-sqlite3"
)

func main() {
	err := sysUtils.Install("算量平台服务", "算量平台服务", "此服务程序为致远算量平台后端服务功能",
		func() {
			loge.W(fmt.Sprintf("准备开启服务,DebugLog:%v", config.ConfigBean.DebugLog))
			go socket.TcpRun(config.ConfigBean.SocketPort)
			mux := http.NewServeMux()
			mux.HandleFunc("/pc/websocket", socket.WebSocketRun)
			api.Run("3389", mux)
		})
	if err != nil {
		loge.W(err)
		panic(err)
	}
}
